﻿// You are given an array of strings. 
// Write a method that sorts the array by the length of its elements (the number of characters composing them).

using System;

class SortArrayByStringLength
{
    static void Main()
    {
        string text = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet consectetur adipisci velit";
        string[] array = text.Split(' ');

        SortByElementLength(array);

        // print Array
        for (int i = 0; i < array.Length; i++)
        {
            Console.Write(array[i]);
            if (i != array.Length - 1)
            {
                Console.Write(", ");
            }
        }
        Console.WriteLine();
    }

    private static void SortByElementLength(string[] array)
    {
        Array.Sort(array, (a, b) => a.Length.CompareTo(b.Length));
    }
}